/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bda.mediatheque.service;

import com.bda.mediatheque.entities.Item;
import com.bda.mediatheque.entities.Utilisateur;
import javax.persistence.Query;

/**
 *
 * @author HP
 */
public class ImpItemDao extends ImplJpaDao<Integer, Item> implements IItemDao{
    
     /*
     * This function is used during the login action to look for the user by its login.
     */
    @Override
    public Item findItemByTitle(String title) {
               try
      {
        Query query = (Query) entityManager.createQuery("select u from Item u where u.title = :title");  
        query.setParameter("title", title);
        
        return (Item) query.getSingleResult();
      } catch (Exception exp) {
          exp.printStackTrace();
          // to do : Add log tool to the project.
          return null;
      }
    }
}

